
def fourSumCount(self, nums1, nums2, nums3, nums4):
    # 使用字典存储nums1和nums2中的元素及其和
    hashmap = dict()
    for n1 in nums1:
        for n2 in nums2:
            if n1 + n2 in hashmap:
                hashmap[n1 + n2] += 1
            else:
                hashmap[n1 + n2] = 1

    # 如果 -(n1+n2) 存在于nums3和nums4, 存入结果
    count = 0
    for n3 in nums3:
        for n4 in nums4:
            key = - n3 - n4
            if key in hashmap:
                count += hashmap[key]
    return count